//
//  CollectionCell.swift
//  Exam-iOS
//
//  Created by lishengfeng on 2018/3/12.
//  Copyright © 2018年 李胜锋. All rights reserved.
//

import Foundation
import SnapKit

class CollectionCell : UITableViewCell {
    
    var leftLbabel:UILabel!
    var rightLabel:UILabel!
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setup()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setup() {
        let backView = UIView.init()
        backView.backgroundColor = UIColor.white
        backView.layer.cornerRadius = 3.0
        backView.layer.borderWidth = 0.5
        backView.layer.borderColor = UIColor.lightGray.cgColor
        contentView.addSubview(backView)
        backView.snp.makeConstraints { (make) in
            make.edges.equalTo(UIEdgeInsetsMake(10, 10, 0, 10))
            make.height.equalTo(55)
        }
        
        leftLbabel = UILabel.init()
        leftLbabel.font = UIFont.systemFont(ofSize: 14)
        leftLbabel.textColor = k_text_black_color
        leftLbabel.textAlignment = .left
        backView.addSubview(leftLbabel)
        leftLbabel.snp.makeConstraints { (make) in
            make.leading.equalTo(12)
            make.centerY.equalToSuperview()
            //            make.top.bottom.equalToSuperview().offset(12)
        }
        
        rightLabel = UILabel.init()
        rightLabel.font = UIFont.systemFont(ofSize: 14)
        rightLabel.textColor = UIColor.lsf_color16(0x19C585)
        rightLabel.textAlignment = .right
        backView.addSubview(rightLabel)
        rightLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.trailing.equalTo(-20)
            make.leading.greaterThanOrEqualTo(leftLbabel.snp.trailing).offset(10)
        }
    }
    
    
    func set(title:String?, likeCount:Int?) {
        leftLbabel.text = title
        rightLabel.text = "收藏\(likeCount ?? 0)题"
    }
}
